package com.itstherules.jmsunit.loaders;

import org.junit.Assert;
import org.junit.Test;


public class SoapLoadingTest {

	static final String SEPARATOR = System.getProperty("line.separator");

	@Test
	public void canLoadSoapAsString() throws Exception {
		FileLoader unit = new SoapLoader();
		String reply = unit.load("test_xml");
		Assert.assertEquals(
				"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" + SEPARATOR +
				"	<SOAP-ENV:Header/>" + SEPARATOR +
				"	<SOAP-ENV:Body>" + SEPARATOR +
				"<hobbit>" + SEPARATOR +
				"	<name>Bilbo Baggins</name>" + SEPARATOR +
				"	<age>12</age>" + SEPARATOR +
				"	<carries>The One Ring</carries>" + SEPARATOR +
				"</hobbit>" + SEPARATOR +
				"	</SOAP-ENV:Body>" + SEPARATOR +
				"</SOAP-ENV:Envelope>"
				, reply);
	}

	@Test(expected=IllegalArgumentException.class)
	public void cannotLoadSoap() throws Exception {
		FileLoader unit = new SoapLoader();
		unit.load("invalid_test_xml");
	}
	
}
